<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

class CreateCooperative extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('cooperative', function (Blueprint $table) {
            $table->integerIncrements('id');
            $table->string('contact',20)->comment('联系方式（手机号码）');
            $table->string('phone', 20)->default('')->comment('绑定手机号');
            $table->string('avatar', 128)->default('')->comment('用户头像');
            $table->string('domain', 32)->comment('域名');
            $table->string('nickname', 32)->comment('合作商名称');
            $table->string('wx_mp_name', 32)->default('')->comment('小程序名称');
            $table->char('wx_mp_appid', 18)->default('')->comment('小程序appid');
            $table->char('wx_mp_secret', 32)->default('')->comment('小程序appsecret');
            $table->char('wx_merchant_secret', 32)->default('')->comment('商户支付密钥');
            $table->char('wx_merchant_code', 18)->default('')->comment('支付商户号');
            $table->string('wx_cert', 128)->default('')->comment('api证书');
            $table->unsignedTinyInteger('status')->default(1)->comment('状态：0禁用，1启用');
            $table->unsignedTinyInteger('bind_mp')->default(0)->comment('是否绑定小程序：0未绑定，1已绑定');
            $table->unsignedTinyInteger('bind_wx_merchant')->default(0)->comment('是否绑定商户号：0未绑定，1已绑定');
            $table->unsignedInteger('province')->default(0)->comment('省份区号');
            $table->unsignedInteger('city')->default(0)->comment('城市区号');
            $table->unsignedInteger('area')->default(0)->comment('地区区号');
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('cooperative');
    }
}
